import { _decorator, CCInteger, Component, Node, Sprite, SpriteFrame } from 'cc';
import { RendorManager } from '../Base/RendorManager';
import DataManger from '../RunTime/DataManager';
const { ccclass, property } = _decorator;

@ccclass('ContentManager')
export class ContentManager extends RendorManager {
    @property(SpriteFrame)
    normalSF: SpriteFrame = null
    
    @property(SpriteFrame)
    successSF: SpriteFrame = null

    @property(CCInteger)
    index: number
    
    rendor(): void {
        const curIndex = DataManger.Instance.H2AData.findIndex(i => i === this.index)
        const successIndex = DataManger.Instance.H2AAnswer.findIndex(i => i === this.index)
        this.getComponent(Sprite).spriteFrame = curIndex === successIndex ? this.successSF : this.normalSF
    }
    
}


